#!/bin/bash

echo "测试SSO单点登录功能..."

# 测试SSO认证URL生成
echo "1. 测试SSO认证URL生成..."
curl -s http://localhost:8080/api/v1/sso/auth | jq .

echo -e "\n2. 测试根据ticket获取token..."
curl -X POST http://localhost:8080/api/v1/sso/checkTicket \
  -H "Content-Type: application/json" \
  -d '{"ticket":"test_ticket_123"}' | jq .

echo -e "\n3. 测试根据token获取用户信息..."
curl -s "http://localhost:8080/api/v1/sso/userinfo?accessToken=test_access_token" | jq .

echo -e "\n4. 测试单点注销..."
curl -X POST http://localhost:8080/api/v1/sso/logout \
  -H "Content-Type: application/json" \
  -d '{"loginId":"user123"}' | jq .

echo -e "\nSSO功能测试完成！"
